<script type="text/javascript">
	function onlyNumbers(evt) 
	{
		evt = (evt) ? evt : window.event
		var charCode = (evt.which) ? evt.which : evt.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57)) {
			//status = "This field accepts numbers only."
			alert("Harus di Isi Angka");
			return false
		}
		//status = ""
		return true 	
	}
</script>
<form method="post" name="frmSearch" action="<?php echo site_url('pettycashcontroller');?>">
    <table width="100%" cellpadding="3" cellspacing="0" border="1">
		<tr>
            <td width="141"><strong>Pilih Search</strong></td>
            <td width="14" align="center"><strong>:</strong></td>
            <td width="832" colspan="3">
                <select name="kdpettyview">
                    <option value="0">Pilih</option>
                    <option value="1">Kode Petty</option>
                    <option value="2">Nama Petty</option>
                </select> &nbsp;|&nbsp;<input type="text"  name="pettyview" id="pettyview" size="50" />&nbsp;|&nbsp;<input type="submit" name="btnview" value="Search">
            </td>
		</tr>
    </table>
</form>
<br />
<form method="post" name="frmsave" action="<?php echo site_url('pettycashcontroller/tambahmasterpetty');?>">
    <table width="100%" cellpadding="3" cellspacing="0" border="1">
    	<tr style="background-color:#FFF; color:#000000;" align="center">
        	<td colspan="3" height="25"><strong>INPUT BUKU CASH KECIL</strong></td>
    	</tr>
        <tr>
            <td width="141"><strong>Kode Petty Cash</strong></td>
            <td width="19" align="center"><strong>:</strong></td>
            <td width="827" colspan="3"><input type="text"  name="kdpetty" id="kdpetty" maxlength="12" size="25" value="{kodepetty}" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="141"><strong>Nama Petty Cash</strong></td>
            <td width="19" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="nmkdpetty" id="nmkdpetty" size="25" maxlength="20"/></td>
        </tr>        
        <tr>
            <td width="141"><strong>Nominal Saldo</strong></td>
            <td width="19" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="nmlsaldo" id="nmlsaldo" size="25" maxlength="20" onkeypress="return onlyNumbers(event);"/></td>
        </tr>
        <tr>
            <td colspan="3" align="center"><input type="submit" value="Save" name="btnSave" >&nbsp;<input type="button" name="btnClose" value="Back" class="btn" onclick="javascript:window.location='<?php echo site_url('menuhomecontroller'); ?>';" /></td>
        </tr>
    </table>
</form>
<br />
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
    <tr style="background-color:#FFF; color:#000000;" align="center">
        <td colspan="7" height="25"><strong>LIST BUKU CASH KECIL</strong></td>
    </tr>
    <tr style="background-color:#333; color:#FFF;" align="center">
        <td>Kode Petty Cash</td>
        <td>Nama Petty Cash</td>
        <td>Saldo</td>
        <?php
		if($this->session->userdata('grade') == 0)
		{
		?>
        <td>&nbsp;</td>
        <?php } ?>
    </tr >
	<?php if(count($masterpetty)>0){ ?>
        {masterpetty}
            <tr class="cellDefault">
                <td align="center">{Kodepettycash}</td>
                <td align="left">{namapettycash}</td>
                <td align="center">Rp&nbsp; {saldo}</td>
  				<td align="center">
  				<?Php 
					if($this->session->userdata('grade') == 0)
					{
				?>
                		<button onclick="javascript:window.location='<?php echo site_url('pettycashcontroller/ubahmasterpetty');?>/{Kodepettycash}';" id="edit">Edit</button>
						&nbsp;|&nbsp;
                    	<button id="hapus" onclick="javascript:window.location='<?php echo site_url('pettycashcontroller/deletemasterpetty');?>/{Kodepettycash}';">Hapus</button>
				<?php } ?>
                </td>
            </tr>
        {/masterpetty}
    <?php } else{
            echo "<tr>";
            echo "<td colspan='9' style='text-align:center;color:red;'>No Data To Display</td>";
            echo "</tr>";
    } ?>
    <?php if(!empty($message))?>{message}
</table>
<?php echo $links; ?>